﻿// See https://aka.ms/new-console-template for more information

using System.Numerics;
using WangfsLib.Math;

BigNumber big1 = 0.7361348065250249;
BigNumber big2 = 0.06874350461584679;
(big1 / big2).ToString();

int cnt = 10;
byte[] data = new byte[6];
Random rand = new Random(DateTime.Now.Millisecond);

for (int i = 0; i < cnt; i++)
{
    double x = rand.NextDouble();
    double y = rand.NextDouble();
    double fa = x + y;
    double fs = x - y;
    double fm = x * y;
    double fd = x / y;

    big1 = x;
    big2 = y;
    BigNumber ba = big1 + big2;
    BigNumber bs = big1 - big2;
    BigNumber bm = big1 * big2;
    BigNumber bd = big1 / big2; // 会有 ÷0 异常
    Console.WriteLine("{3} {0}\t\t+{1}\t\t=  {2}\t\t{4}", big1, big2, ba, ba == fa ? "√" : "×", fa);
    Console.WriteLine("{3} {0}\t\t-{1}\t\t=  {2}\t\t{4}", big1, big2, bs, bs == fs ? "√" : "×", fs);
    Console.WriteLine("{3} {0}\t\t*{1}\t\t=  {2}\t\t{4}", big1, big2, bm, bm == fm ? "√" : "×", fm);
    Console.WriteLine("{3} {0}\t\t/{1}\t\t=  {2}\t\t{4}", big1, big2, bd, bd == fd ? "√" : "×", fd);
    Console.WriteLine("²√{0}\t\t={1}", big1 * big1, MathUtils.Sqrt(big1 * big1));
    Console.WriteLine("²√{0}\t\t={1}", big2 * big2, MathUtils.Sqrt(big2 * big2));
}

Console.ReadLine();